import {
    createStore
} from 'vuex'
import user from './modules/user'
import cate from './modules/cate'
import cart from './modules/cart'
import createPersistedstate from 'vuex-persistedstate'
export default createStore({
    modules: {
        user,
        cate,
        cart
    },
    plugins: [
        createPersistedstate({
            // key
            key: 'kuaijian-rabbit',
            // 存储方式: user数据应该存到sessionStorage,car数据应该存到localStorage
            storage: window.sessionStorage,
            // 哪些模块需要做持久化存储
            paths: ['user']
        }),
        createPersistedstate({
            // key
            key: 'kuaijian-rabbit',
            // 存储方式: user数据应该存到sessionStorage,car数据应该存到localStorage
            storage: window.localStorage,
            // 哪些模块需要做持久化存储
            paths: ['cart']
        })
    ]
})